<template>
	<view class="container">
		<text class="title">测评设置</text>
		<u-radio-group class="radio-group" v-model="evaluateType">
			<view class="item" @click="optionClick('enterprise')">
				<view class="content">
					<text class="name">专家模式</text>
					<text class="desc">适合对测评非常熟悉的老师</text>
				</view>
				<u-radio :checked="evaluateType === 'enterprise'" name="enterprise"></u-radio>
			</view>
			<view class="line"></view>
			<view class="item" @click="optionClick('pro')">
				<view class="content">
					<text class="name">辅助模式</text>
					<text class="desc">适合对测评有一定了解的老师</text>
				</view>
				<u-radio :checked="evaluateType === 'pro'" name="pro"></u-radio>
			</view>
			<view class="line"></view>
			<view class="item" @click="optionClick('normal')">
				<view class="content">
					<text class="name">向导模式</text>
					<text class="desc">适合对测评还在学习中的老师</text>
				</view>
				<u-radio :checked="evaluateType === 'normal'" name="normal"></u-radio>
			</view>
		</u-radio-group>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				evaluateType: '',
			}
		},
		onLoad() {
			this.getEvaluateType();
		},
		methods: {
			optionClick(value) {
				console.log(value);
				this.evaluateType = value;
				this.setEvaluateType(value);
			},
			getEvaluateType() {
				try {
				    this.evaluateType = uni.getStorageSync('evaluate_type');
				} catch (e) {
				}
			},
			setEvaluateType(value) {
				uni.setStorage({
				    key: 'evaluate_type',
				    data: value,
				});
			}
		}
	}
</script>

<style lang="scss">
	.container{
		display: flex;
		flex-direction: column;
	}
	
	.title{
		margin-top: 30rpx;
		margin-left: 30rpx;
	}
	
	.radio-group{
		margin-top: 30rpx;
		margin-left: 60rpx;
		margin-right: 30rpx;
		display: flex;
		flex-direction: column;
		
		.item{
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-top: 30rpx;
			margin-bottom: 30rpx;
			
			.content{
				flex: 1;
				display: flex;
				flex-direction: column;
				
				.name{
					font-size: 30rpx;
				}
				
				.desc{
					font-size: 24rpx;
				}
			}
		}
		
		.line{
			height:2rpx;
			background-color: rgba(230,230,230,1);
			opacity:1;
		}
	}
</style>
